/*$Id: VelocityWorker.java 5 2010-10-17 00:31:54Z vip.delete $*/

/**
 * Copyright vip_delete
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.googlecode.eclipseplugin;

import org.apache.velocity.Template;
import org.apache.velocity.app.Velocity;

/**
 * Init velocity and load templates
 *
 * @author vip_delete
 * @since 27.07.2010
 */
class VelocityWorker
{
    private Template projectTemplate;
    private Template classpathTemplate;
    private Template modulesTemplate;

    public VelocityWorker() throws Exception
    {
        Velocity.addProperty("resource.loader", "class");
        Velocity.addProperty("class.resource.loader.class", "org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader");
        Velocity.init();

        projectTemplate = Velocity.getTemplate("eclipseplugin/project.vm");
        classpathTemplate = Velocity.getTemplate("eclipseplugin/classpath.vm");
        modulesTemplate = Velocity.getTemplate("eclipseplugin/project-modules.vm");
    }

    // Getters

    public Template getProjectTemplate()
    {
        return projectTemplate;
    }

    public Template getClasspathTemplate()
    {
        return classpathTemplate;
    }

    public Template getModulesTemplate()
    {
        return modulesTemplate;
    }
}
